﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using AvalonDock;
namespace PotatoSoft.CustomControl
{
    /// <summary>
    /// Interaction logic for DockableContentControl.xaml
    /// </summary>
    public partial class DockableContentControl : UserControl
    {
        private static readonly DependencyProperty ShowProperty = DependencyProperty.Register(
            "Show",
            typeof(bool),
            typeof(DockableContentControl),
            new FrameworkPropertyMetadata(null,
                FrameworkPropertyMetadataOptions.AffectsRender,
                new PropertyChangedCallback(OnShowChanged)
                )
            );

        public bool Show
        {
            get { return (bool)GetValue(ShowProperty); }
            set { SetValue(ShowProperty, value); }
        }

        private static void OnShowChanged(DependencyObject dependencyObject,
                                                  DependencyPropertyChangedEventArgs e)
        {
            if (dependencyObject == null)
            {
                return;
            }
            var doc = dependencyObject as DockableContentControl ;
            if (doc == null) return;

            var objects = (bool)e.NewValue;
        //    if (objects)
                //doc.Show();
         //   else
           //     doc.Close();
        }
        public DockableContentControl()
        {
            InitializeComponent();
            
        }
    }
}
